// pages/video/video.js
Page({
  data: {
    videoSrc: '' // 视频源URL
  },

  onLoad: function(options) {
    const courseId = options.course;
    let videoSrc = '';
    switch(courseId) {
      case 'course1':
        videoSrc = 'https://vjs.zencdn.net/v/oceans.mp4'; // 替换为真实的视频URL
        break;
      case 'course2':
        videoSrc = 'https://vjs.zencdn.net/v/oceans.mp4'; // 替换为真实的视频URL
        break;
      // 添加更多课程的视频源
    }
    this.setData({
      videoSrc: videoSrc
    });
  },
  
  playVideo: function() {
    const videoContext = wx.createVideoContext('courseVideo');
    videoContext.play();
  },
  
  pauseVideo: function() {
    const videoContext = wx.createVideoContext('courseVideo');
    videoContext.pause();
  }
});
